﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Ppt = Microsoft.Office.Interop.PowerPoint;

namespace ObjectModel.PowerPoint.RulesModel
{
    /// <summary>
    /// A PowerPoint chart point object that can resolve itself from serializable info.
    /// </summary>
    public class ResolvableChartPoint : ResolvableObject
    {
        public ResolvableChartSeries Series { get; set; }
        
        public int PointIndex { get; set; }

        //[XmlIgnore]
        //public Ppt.Point Point { get { return Resolve() as Ppt.Point; } }

        public ResolvableChartPoint() { } // Parameterless constructor required for serialization.

        public ResolvableChartPoint(Ppt.Shape parent, int seriesIndex, int pointIndex)
        {
            Series = new ResolvableChartSeries(parent, seriesIndex);
            PointIndex = pointIndex;
        }

        public override object Resolve()
        {
            Ppt.Series series = Series.Resolve() as Ppt.Series;
            return series.Points(PointIndex);
        }
    }
}
